<?php

/*
#-----------------------------------------------------------#
#
#  File name: index.php
#  File description: tarantula engine
#  Built on: 05.10.2008
#  Last modified date: 05.10.2008
#  Last modified by: John
#
#-----------------------------------------------------------#
*/

/*
# Object specifications:
# -
*/

class Tarantula {
	var $url = 'http://www.dirpedia.ro/download/directoare-web.xml';
	var $parsed = 'http://morion4000.bitgeek.info/tarantula/log/parsed.xml';
	var $junk = 'http://morion4000.bitgeek.info/tarantula/log/junk.xml';
	
	function addParse ( $url ) {
		$this -> fileOp ( $url, $this -> parsed, '../log/parsed.xml' );
	}
	
	function addJunk ( $url ) {
		$this -> fileOp ( $url, $this -> junk, '../log/junk.xml' );
	}
	
	function fileOp ( $url, $location, $location_r ) {
		$feed = dirParser::getFeed ( $location );
		$date = date ( 'Y-m-d', mktime ( date ('H')+7 ) );
		$lists = new SimpleXMLElement ( $feed );
		$director = $lists -> addChild ( 'director' );
		$director -> addChild ( 'url', $url );
		$director -> addChild ( 'data', $date );
		file_put_contents ( $location_r, $lists->asXML() );
	}
}

?>